import 'package:get/get.dart';
import 'package:ylm_ui_kit/ylm_ui_kit.dart';

import '../../../article/post/article_post_bean.dart';
import '../../../local_data/local_data_utils.dart';

class MineAticalLogic extends GetxController {
  List<PostArticleBean> list = [];

  @override
  void onReady() {
    super.onReady();

    list = MyPostArticleUtils.get();
    update();
  }

  void delete(String recordId) {
    if (recordId.empty) return;
    Loading.show();
    Future.delayed(const Duration(seconds: 1), () {
      list.removeWhere((element) => element.recordId == recordId);
      update();
      Loading.toast('success', closeLoading: true);
    });

    MyPostArticleUtils.remove(recordId);
  }
}
